﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
    <xsl:import href="../Common/meta.xsl"/>
    <xsl:output method="html" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
    <xsl:param name="lang" select="'chi'"></xsl:param>
    <xsl:variable name="headers" select="document('headers.xml')//header[@lang=$lang]"></xsl:variable>
    <xsl:template match="/">
      <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
          <title>
            <xsl:value-of select="$headers/title"/>
          </title>
          <xsl:call-template name="content-lang"></xsl:call-template>
          <xsl:call-template name="css"></xsl:call-template>
          <xsl:call-template name="script"></xsl:call-template>
          <script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
          <script type="text/javascript">
            var pageTracker = _gat._getTracker("UA-3662766-1");
            pageTracker._initData();
            pageTracker._trackPageview();
          </script>
        </head>
        <body>
          <div id="SpecialActivities">
            <table>
              <xsl:for-each select="activities/article">
                <tr>
                  <th>
                    <xsl:value-of select="@day" />/<xsl:value-of select="@month"/>/<xsl:value-of select="@year"/>
                  </th>
                  <td>
                    <a>
                      <xsl:attribute name="href">
                        <xsl:value-of select="item[@lang=$lang]/a/@href"/>
                      </xsl:attribute>
                      <xsl:attribute name="target">
                        <xsl:value-of select="item[@lang=$lang]/a/@target"/>
                      </xsl:attribute>
                      <xsl:value-of select="item[@lang=$lang]/a"/>
                    </a>
                  </td>
                </tr>
              </xsl:for-each>
            </table>
          </div>
        </body>
      </html>
    </xsl:template>

    <xsl:template name="css">
      <xsl:for-each select="$headers/css">
        <link rel="stylesheet" type="text/css">
          <xsl:attribute name="media">
            <xsl:value-of select="@media"/>
          </xsl:attribute>
          <xsl:attribute name="href">
            <xsl:value-of select="."/>
          </xsl:attribute>
        </link>
      </xsl:for-each>
    </xsl:template>

    <xsl:template name="script">
      <xsl:for-each select="$headers/script">
        <script>
          <xsl:attribute name="type">
            <xsl:value-of select="@type"/>
          </xsl:attribute>
          <xsl:attribute name="src">
            <xsl:value-of select="."/>
          </xsl:attribute>
        </script>
      </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
